var path = require("path");
var isDev = process.env.NODE_ENV === "development";

function resolve(dir) {
  return path.join(__dirname, dir);
}

let publicPath = isDev ? "/tool1" : "/tool1/static";
let outputDir = "./dist/static";
let indexPath = "../index.html";

module.exports = {
  productionSourceMap: isDev,
  publicPath,
  outputDir,
  indexPath,
  lintOnSave: true,
  chainWebpack: (config) => {
    config.resolve.alias.set("@", resolve("src")); // 设置别名 @ 等于src
  },
  devServer: {
    publicPath,
    proxy: {
      "/api": {
        target: "http://shequ.leiting.com/",
        changeorigin: true,
        pathrewrite: { "^/": "/" },
      },
    },
  },
};
